import request from '@/utils/request'

// 登录
export function loginApi(data) {
  return request({
    url: '/user-service/user/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfoApi(id) {
  return request({
    url: `/user-service/user/${id}`,
    method: 'get',
  })
}

// 人员搜索
export const searchUserApi = params => request.get('/user-service/user/search', {params})

// 获取角色列表
export const getUserListApi = () => request.get(`/user-service/role`)

// 新增人员
export const addRoleApi = data => request.post(`/user-service/user`, data)

// 修改人员
export const editRoleApi = data => request.put(`/user-service/user/${data.id}`, data)

// 删除人员
export const delUserApi = id => request.delete(`/user-service/user/${id}`)

// 获取当时工单汇总信息(人员统计头部信息)
export const gettaskReportInfoApi = data => request.get(`/task-service/task/taskReportInfo/${data.start}/${data.end}`)

// 获取用户工作量(工单统计)
export const getTaskuserWorkApi = params => request.get(`/task-service/task/userWork`, {params})

// 获取工作量排名
export const getWorkTop10Api = data => request.get(`/task-service/task/userWorkTop10/${data.start}/${data.end}/${data.isRepair}/${data.regionId}`)

// 人员工作量列表
export const searchUserWorkApi = params => request.get('/user-service/user/searchUserWork', {params})
